#pragma once

#include "../util.hpp"
#include "../result.hpp"

namespace pharmacy_server
{
    class UserView
    {
    public:
        Result login_user(bool succ, const std::string& desc = "login failed")
        {
            if (succ)
                return Result(Result::SUCCESS, "login success");
            else
                return Result(Result::FAILED, desc);
        }

        Result register_user(bool succ, const std::string& desc)
        {
            if (succ)
                return Result(Result::SUCCESS, desc);
            else
                return Result(Result::FAILED, desc);
        }

        Result delete_user(bool succ, const std::string& desc)
        {
            if (succ)
                return Result(Result::SUCCESS, desc);
            else
                return Result(Result::FAILED, desc);
        }

        Result update_user(bool succ, const std::string& desc)
        {
            if (succ)
                return Result(Result::SUCCESS, desc);
            else
                return Result(Result::FAILED, desc);
        }

        Result get_user(bool succ, const std::string& desc, const std::string& data = "")
        {
            if (succ)
                return Result(Result::SUCCESS, desc, data);
            else
                return Result(Result::FAILED, desc);
        }

        Result current_user(bool succ, const std::string& desc, const std::string& data = "")
        {
            if (succ)
                return Result(Result::SUCCESS, desc, data);
            else
                return Result(Result::FAILED, desc);
        }

        Result logout_user(bool succ, const std::string& desc = "")
        {
            if (succ)
                return Result(Result::SUCCESS, "logout success");
            else if (!desc.empty())
                return Result(Result::FAILED, desc);
            else
                return Result(Result::FAILED, "logout failed");
        }
    };
}